#include<iostream>

using namespace std;
const int N = 210, M = 500;
int n; 
int f[N][M];
void add(int a[], int b[], int c[])
{
	for (int i = 0; i < M - 1; i++)
	{
		a[i] += b[i] + c[i];
		a[i + 1] += a[i] / 10;
		a[i] %= 10;
	}
}
void mul(int a[], int x)
{
	int t = 0;
	for (int i = 0; i < M - 1; i++)
	{
		t += a[i] * x;
		a[i] = t % 10;
		t /= 10;
	}
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> f[0][0];
	f[2][0] = 1;

	for (int i = 3; i <= n; i++)
	{
		add(f[i], f[i - 1], f[i - 2]);
		mul(f[i], i - 1);
	}
	int p = M - 1;
	while (f[n][p] == 0) p--;
	while (p>= 0) cout << f[n][p--];

	return 0;
}